from flask import Flask,request,render_template
app = Flask(__name__)

@app.route('/',methods=['GET'])
def index():
    return "hello"

@app.route('/login',methods=['GET','POST'])
def login():
    username = request.args.get('username')
    password = request.args.get('password')
    print(username,password)
    # 1.基本响应方式 : 返回字符串（自动转为HTML响应）, 返回HTML模板（常用）
    # return "login"
    # return "<strong>login</strong>"

    # 2.返回HTML模板: 引入render_template
    return render_template('hello.html',name=username)  # 自动查找templates/hello.html


if __name__ == '__main__':
    app.run(debug=True)